 /*
  *Copyright (c) 2003, 2018, UMF and/or its affiliates. All rights reserved.
  *
  */
 package com.umpay.utils;

 import java.util.HashMap;
 import java.util.Map;

 /**
  * @description: 消费订单查询-状态转换工具类
  * @author: lile
  * @create: 2019-03-22 10:27
  **/
 public class ConsumeOrderQryStateTranstitionUtil {

     private static final String DEFAULT_STATE_KEY = "default";

     /**
      * 消费订单状态值-映射
      */
     private static final Map<String, String> CONSUMEORDER_STATE_CONV = new HashMap<String, String>() {{
         put("0","0");
         put("1","1");
         put("2","1");
         put("3","2");
         put("4","3");
         put("5","3");
         put("6","3");
         put("7","3");
         put("8","3");
         put("9","0");
         put("10", "2");
         put("11","1");
         put("12","3");
         put("13","3");
         put("14","3");
         put("15","3");
         put("16","3");
     }};


     /**
      * 交易状态状态值-映射
      */
     private static final Map<String, String> TRANS_STATE_CONV = new HashMap<String, String>() {{
         put("-99", "0");
         put("0", "1");
         put("1", "2");
     }};

     /**
      * 退费状态状态值-映射
      */
     private static  final Map<String,String> REFUND_STATE_CONV = new HashMap<String,String>() {{
         put("0", "0");
         put("7", "1");
         put("2", "2");
         put("6", "2");
         put("9", "2");
         put("12", "2");
         put(DEFAULT_STATE_KEY, "3");

     }};


     /**
      * 分账模块子订单状态值-映射
      */
     private static final Map<String,String> SPLIT_MOUDLE_SUB_ORDER_STATE_CONV = new HashMap<String,String>() {{
         put("0", "0");
         put("1", "3");
         put("2","3");
         put("3","3");
         put("4","1");
         put(DEFAULT_STATE_KEY,"3");
     }};

     /**
      * 分账模块订单状态值-映射
      */
     private static final Map<String,String> SPLIT_MOUDLE_ORDER_STATE_CONV = new HashMap<String,String>() {{
         put("0", "0");
         put("1", "1");
         put("2","3");
         put("3","3");
     }};


     /**
      * 消费订单状态转换
      * @param oriOrderState
      * @return
      */
     public static String getConsumeOrderStateConv(String oriOrderState) {
         return CONSUMEORDER_STATE_CONV.get(oriOrderState);
     }

     /**
      * 交易订单状态转换
      * @param oriState
      * @return
      */
     public static String getTranSateConv(String oriState) {
         return TRANS_STATE_CONV.get(oriState);
     }

     /**
      * 退费订单状态转换
      * @param oriState
      * @return
      */
     public static String getRefundStateConv(String oriState) {
         String convState = REFUND_STATE_CONV.get(oriState);
         if (StringUtils.isEmpty(convState)) {
             convState = REFUND_STATE_CONV.get(DEFAULT_STATE_KEY);
         }
         return convState;
     }

     /**
      * 分账模块子订单状态转换
      * @param oriState
      * @return
      */
     public static String getSplitMoudleOrderSubStateConv(String oriState) {


         String convState = SPLIT_MOUDLE_SUB_ORDER_STATE_CONV.get(oriState);
         if (StringUtils.isEmpty(convState)) {
             convState = SPLIT_MOUDLE_SUB_ORDER_STATE_CONV.get(DEFAULT_STATE_KEY);
         }
         return convState;
     }

     /**
      * 分账模块订单状态转换
      * @param oriState
      * @return
      */
     public static String getSplitMdudleOrderStateConv(String oriState) {
         return SPLIT_MOUDLE_ORDER_STATE_CONV.get(oriState);
     }




 }
